//
//  BBThemeColorManger.m
//  BlockBrowser
//
//  Created by Mac on 2018/4/23.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "BBThemeColorManger.h"

@implementation BBThemeColorManger
+ (BBThemeColorManger *)manger{
    static  BBThemeColorManger * manger = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manger  = [ BBThemeColorManger new];
    });
    return manger;
}
+ (BOOL)isBlack{
    if ([BBThemeColorManger manger].type == BBThemeColorStyleBlacklook) {
        return YES;
    }
    return NO;
}
+ (UIColor *)blackStyletableBacgroundColor{
    if ([BBThemeColorManger manger].type == BBThemeColorStyleBlacklook) {
        return [UIColor colorWithRed:24/255.0 green:21/255.0 blue:21/255.0 alpha:1];
    }
    return BACKROUND_COLOR;
}
+ (UIColor *)blackStyletableGrayBackColor{
    if ([BBThemeColorManger manger].type == BBThemeColorStyleBlacklook) {
        return [UIColor colorWithRed:138/255.0 green:144/255.0 blue:147/255.0 alpha:1];
    }
    return UIColor.whiteColor;
}
- (void)changeColorStyle:(BBThemeColorStyle )style{
    bool isOpenBlackLook = NO;
    if (style == BBThemeColorStyleBlacklook) {
        isOpenBlackLook = YES;
    }
    [[NSUserDefaults standardUserDefaults] setBool:isOpenBlackLook forKey:isBlackLookKey];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
- (BBThemeColorStyle)type{
    bool isOpenBlackLook = [[NSUserDefaults standardUserDefaults] boolForKey:isBlackLookKey];
    if (isOpenBlackLook) {
        return BBThemeColorStyleBlacklook;
    }
    return BBThemeColorStyleNormal;
}
- (UIColor *)backGroundColor{
    BBThemeColorStyle style = self.type;
    if (style == BBThemeColorStyleBlacklook) {
        UIColor * black = [UIColor.flatBlackColorDark colorWithAlphaComponent:0.9];
        return black;
    }
    return UIColor.whiteColor;
}
- (UIColor *)firstTextColor{
    BBThemeColorStyle style = self.type;
    if (style == BBThemeColorStyleBlacklook) {
        return ThirdTextColor;
    }
    return FirstTextColor;
}
- (UIColor *)thirdTextColor{
    BBThemeColorStyle style = self.type;
    if (style == BBThemeColorStyleBlacklook) {
        return FirstTextColor;
    }
    return ThirdTextColor;
}
- (UIColor *)themeColor{
    BBThemeColorStyle style = self.type;
    if (style == BBThemeColorStyleBlacklook) {
        return [UIColor.blackColor colorWithAlphaComponent:1];
    }
    return TM_ThemeBackGroundColor;
}
@end
